package com.jeesite.modules.digitalize.constants;

import java.util.Arrays;

public enum RelationTypeEnum {
    TASK_NOTE(1, "TaskNote"),
    TASK_LABEL(2, "TaskLabel"),
    TASK_DETAIL_NOTE(3, "TaskDetailNote"),
    TASK_DETAIL_LABEL(4, "TaskDetailLabel");

    private final int code;
    private final String description;

    RelationTypeEnum(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static RelationTypeEnum getByCode(int code) {
        return Arrays.stream(RelationTypeEnum.values())
                .filter(item -> item.code == code)
                .findFirst()
                .orElse(null);
    }
}